<?php

defined('_JEXEC') or die('Restricted access');

global $_DMUSER;

$item_title_link = isset($this->theme->conf->item_title_link) ? $this->theme->conf->item_title_link : '1'; ?>
<?php $path = $this->doc->data->dmthumbnail ? $this->doc->paths->thumb : $this->doc->paths->icon; ?>		
<div class="dm_row <?php echo @$this->theme->conf->style ? 'dm_dark' : 'dm_light'; ?>">
	<table class="archives_list">
	<tr>
	<td>
	<div class="dm_title">
	<?php
	// output title
	switch($item_title_link) :
	 	case 0 :  //no link
			echo $this->doc->data->dmname;
		break;

		case 1 :  // link to download, if download is allowed
		//	if($_DMUSER->canDownload($this->doc->data->id)) 
			if(isset($this->doc->buttons['download'])){
	            ?><a href="<?php echo $this->doc->data->permalink;?>"  
	            	title="<?php 
	            	echo $this->doc->data->dmname;
	                echo ' ';
	            	echo htmlspecialchars(substr($this->doc->data->dmdescription,3,-4))
	            	?>">
					<?php echo htmlspecialchars($this->doc->data->dmname) ?>
				</a><?php
       		} else {
            	echo htmlspecialchars($this->doc->data->dmname);
        	}
		break;

	 	case 2  :  // link to details
			?><a href="<?php echo $this->doc->data->permalink;?>" title="<?php echo $this->doc->data->dmname; ?>">
				<?php echo $this->doc->data->dmname; ?>
			</a><?php
	 	break;
	endswitch;
	?>
	</div>
	</td>
	<td>		
	<div class="dm_details <?php echo @$this->theme->conf->style ? 'dm_dark' : 'dm_light'; ?>">
		<?php if($this->theme->conf->item_date ) : ?>
			<?php // output document date added
				if ( $this->theme->conf->item_date ) : ?>
		   		<?php $this->plugin('dateformat', $this->doc->data->dmdate_published, _DML_TPL_DATEFORMAT_SHORT); ?>
			<?php endif; ?>
		<?php endif?>
	</div>
    </td>


    <td>
	<div class="dm_description">
		<a href="<?php echo $this->doc->buttons['download']->link;?>" title="<?php echo htmlspecialchars($this->doc->data->dmname)?>">
				<?php echo $this->doc->data->dmdescription;?>
		</a>
		
	</div>
	</td>	
</tr>
</table>



<?php
if(!$this->doc->data->approved) {
	?><div class="dm_unapproved"><?php echo _DML_NOAPPROVED_DOWNLOAD; ?></div><?php
} elseif(!$this->doc->data->published) {
	?><div class="dm_unpublished"><?php echo _DML_NOPUBLISHED_DOWNLOAD; ?></div><?php
} elseif($this->doc->data->checked_out) {
    ?><div class="dm_checked_out"><?php echo _DML_NOTDOWN; ?></div><?php
}?>
<!--
<div class="dm_taskbar <?php echo @$this->theme->conf->style ? 'dm_dark' : 'dm_light'; ?>">
    <ul>
    <?php include $this->loadTemplate('documents'.DS.'tasks.tpl.php');  ?>
    </ul>
    <div class="clr"></div>
</div>
-->
</div>